/*
 * 版权所有(c)  1952110078@qq.com  2022 - 2022
 */

package com.ldc.module_main.adaapter;

import android.widget.ImageView;

import com.ldc.commonlibs.common.RecyclerAdapterBase;
import com.ldc.commonlibs.common.RecyclerViewHolder;
import com.ldc.commonlibs.utils.GlideUtil;
import com.ldc.module_main.R;
import com.ldc.module_main.model.FlowsModel;

/**
 * @author liudc
 * @since 2022/7/23 18:17
 */
public class FlowsAdapter extends RecyclerAdapterBase<FlowsModel.FollowBean> {
    private static final String TIME_TAG = "0";

    public FlowsAdapter() {
        super(R.layout.main_layout_view_item_flows);
    }

    @Override
    protected void convertData(RecyclerViewHolder holder, FlowsModel.FollowBean data, int position) {
        ImageView logo = (ImageView) holder.getView(R.id.iv_logo);
        GlideUtil.setImageViewCircleCrop(logo, data.getAvatarUrl());
        holder.setText(R.id.tv_nike_name, data.getNickname());
        holder.setText(R.id.tv_content, data.getSignature());
        holder.setText(R.id.tv_time, data.getTime().equals(TIME_TAG) ? "刚刚" : "---");
        if (data.getVipRights() != null) {
            String vipType = data.getVipRights().getRedVipLevel();
            boolean isVip = false;
            if (data.getVipRights().getAssociator() != null) {
                isVip = data.getVipRights().getAssociator().isRights();
            }
            holder.setVisibility(R.id.tv_vip, isVip);
            if (isVip) {
                holder.setText(R.id.tv_vip, "VIP" + vipType);
            }
        } else {
            holder.setVisibility(R.id.tv_vip, false);
        }
    }
}
